<?php
namespace app\system\validate;

use think\Validate;

/**
 * 企业账号验证器
 * @package app\manger\validate\company
 */
class Manager extends Validate
{
    protected $rule = [
        'username' => 'require|min:3|unique:manage,username',
        'password' => 'require|min:5',
        'truename' => 'require',
        'group_id' => 'require|number',
//        'tel' => ['require', 'regex' => '/^(13[0-9]|14[5,7]|15[0-9]|18[0-9]|17[0-9])\d{8}$/'],
    ];

    protected $message = [
        'username.require' => '登录账号不能为空!',
        'username.min' => '登录帐号长度不能少于3!',
        'username.unique' => '登录账号重复!',
        'password.require' => '登录密码不能为空!',
        'password.min' => '登录密码长度不能少于5!',
        'truename.require' => '姓名不能为空!',
        'group_id.require' => '请选择用户组!',
        'group_id.number' => '非法用户组!',
//        'tel.require' => '联系电话不能为空!',
//        'tel.regex' => '联系电话格式错误!',
    ];

    protected $scene = [
        'edit' => [
            'username',
            'truename',
            'group_id',
            'tel',
        ],
        'info' => [
            'username',
            'truename',
            'tel',
        ],
    ];
}